package com.wangjiyuan.giftshuo.ui.activity.classify.shop_details;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.wangjiyuan.giftshuo.bean.classifybean.shop.ShopDetLayoutBean;
import com.wangjiyuan.giftshuo.bean.classifybean.shop.TreeBean;
import com.wangjiyuan.giftshuo.config.classify.ClassifyConstant;
import com.wangjiyuan.giftshuo.config.classify.ClassifyURL;
import com.wangjiyuan.giftshuo.http.classityretrofitinterface.RetrofitInterface;
import com.wangjiyuan.giftshuo.utils.OkHttp3Helper;

import java.util.Map;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;

/**
 * Created by QXL on 2016/11/23.
 */

public class ShopDetLayoutModel implements ShopDetLayoutContract.IShopDetLayoutModel {
    @Override
    public Observable<ShopDetLayoutBean> getShopDetLayoutObservable(int id, Map<String, Integer> paramsMap) {

        Retrofit retrofit=new Retrofit.Builder()
                .baseUrl(ClassifyURL.BASE_URL)
                .client(OkHttp3Helper.getOkHttpSingletonInstance())
                .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        RetrofitInterface retrofitInterface = retrofit.create(RetrofitInterface.class);
        Observable<ShopDetLayoutBean> shopDetLayoutObservable = retrofitInterface.getShopDetLayoutObservable(id, paramsMap);
        return shopDetLayoutObservable;
    }
}
